#pragma once

#include <gofcl_usbfs_gahbcs.h>

typedef enum {
	USBFS_GAHBCS_EMPTY_TH_HALF = 0,
	USBFS_GAHBCS_EMPTY_TH_ALL = 1,
} usbfs_gahbcs_empty_th_e;

typedef struct {
	u32_s global_int_en : 1;
	u32_s : 6;
	usbfs_gahbcs_empty_th_e trans_fifo_low_th : 1;
	usbfs_gahbcs_empty_th_e periodic_trans_fifo_low_th : 1;
	u32_s : 23;
} usbfs_gahbcs_expl_s;

_Static_assert(sizeof(usbfs_gahbcs_expl_s) == 4,
	       "Struct usbfs_gahbcs_expl_s defined error!");

static inline void usbfs_set_global_ahb_ctl(usbfs_gahbcs_expl_s gahbcs) {
	union {
		usbfs_gahbcs_expl_s e;
		usbfs_gahbcs_s g;
	} gu = {
		.e = gahbcs,
	};
	usbfs_wreg_gahbcs_s(gu.g);
}
